#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["VOL.WebApi/VOL.WebApi.csproj", "VOL.WebApi/"]
COPY ["MES.Equipment/MES.Equipment.csproj", "MES.Equipment/"]
COPY ["VOL.Core/VOL.Core.csproj", "VOL.Core/"]
COPY ["VOL.Entity/VOL.Entity.csproj", "VOL.Entity/"]
COPY ["MES.Tool/MES.Tool.csproj", "MES.Tool/"]
COPY ["MES.Production/MES.Production.csproj", "MES.Production/"]
COPY ["MES.Calendar/MES.Calendar.csproj", "MES.Calendar/"]
COPY ["VOL.Builder/VOL.Builder.csproj", "VOL.Builder/"]
COPY ["VOL.Quality/VOL.Quality.csproj", "VOL.Quality/"]
COPY ["VOL.System/VOL.System.csproj", "VOL.System/"]
COPY ["VOL.View/VOL.View.csproj", "VOL.View/"]
RUN dotnet restore "VOL.WebApi/VOL.WebApi.csproj"
COPY . .
WORKDIR "/src/VOL.WebApi"
RUN dotnet build "VOL.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "VOL.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "VOL.WebApi.dll"]